trigger AddProducts on Mediator__c (After Insert) {
  Set<Id> MedId = New Set<Id>();
  Set<Id> OpId = New Set<Id>();
  Set<Id> ProId = New Set<Id>(); 
  Set<String> PName = New Set<string>(); 
  OpportunityLineItem pon = new OpportunityLineItem();
  for(Mediator__c Med : Trigger.New){
   MedId.add(Med.Id);
   OpId.add(Med.Opportunity__c);
   ProId.add(Med.Product__c);
  }
  List<Opportunity> opll = New List<Opportunity>();
 List<Mediator__c> MdList = [Select Id,Opportunity__c,Product_1__c,Product_1_price__c,Product_2__c,Product_2_price__c from 
                               Mediator__c where Id =:MedId];
 List<Opportunity> OPList = [Select Id,Pricebook2Id from Opportunity where Id =:OpId];
 List<OpportunityLineItem> OpPList = [Select Id,OpportunityId from OpportunityLineItem where OpportunityId =:OpId];
 List<Product2> PrList = [Select Id from product2 where Id =: ProId];
 List<OpportunityLineItem> poListAd = New List<OpportunityLineItem>(); 
  delete OpPList;  
  for(Mediator__c Med : Trigger.New){   
       for(Opportunity OPo : OPList){
         OPo.Pricebook2Id = '01s90000000Uo08AAC';                          
         pon.OpportunityId = Med.Opportunity__c;
         pon.PricebookEntryId ='01u9000000215HjAAI';
         pon.Quantity = 3;   
         pon.TotalPrice = 2332;    
       update OPo;
     poListAd.add(pon); 
      }     
    Insert poListAd;
    System.debug('Chech the oppline item' + poListAd);
  }
}